import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn } from "typeorm";

@Entity('user')
export class UserEntity {
  @PrimaryGeneratedColumn()
  id: number;  // 这个字段是主键，且自动生成

  /**
   * nullable: false(字段不能为空)
   * unique: true (该字段在数据库中必须唯一)
   */
  @Column({ length: 50, comment: '账号',nullable: false, unique: true})
  account: string;

  @Column({ length: 255, comment: '密码',nullable: false})
  password: string;

  @Column({ length: 50, comment: '昵称',nullable: false})
  username: string;

  @CreateDateColumn({ comment: '创建时间' })
  createdAt: Date;

  @UpdateDateColumn({ comment: '更新时间' })
  updatedAt: Date;
}
